<?php
namespace app\admin\controller\store;

use app\common\model\Store as Model;

use app\admin\classes\BasicManager;
use core\Api;
use core\V;
use core\Res;

/**
 * 库位管理
 */


 class Manager extends BasicManager {

   static $model=Model::class;


   static $var="id,code,name,location,remark";

   static $title=[
     "index"=>[
       "title"=>"库位管理",
       "breadcrumb"=>["库位","列表"],
       "subtitle"=>"管理库位",
     ],
     "add"=>[
       "title"=>"添加库位",
       "breadcrumb"=>["库位","添加"],
       "subtitle"=>"请添加库位",
     ],
     "edit"=>[
       "title"=>"编辑库位",
       "breadcrumb"=>["库位","编辑"],
       "subtitle"=>"编辑库位",
     ],

   ];

   public function save_filter(&$data){
     empty($data["name"]) and Api::error('请输入名称');

     // $this->db_has($data,"code") and Api::error('编码已存在');
     $this->db_has($data,"name") and Api::error('名称已存在');

     return $data;
   }

   public function edit_body(){
     return '


     <el-form-item label="名称">
       <el-input v-model="form.name"></el-input>
     </el-form-item>

     <el-form-item label="位置">
       <el-input v-model="form.location"></el-input>
     </el-form-item>

     <el-form-item label="备注">
       <el-input type="textarea" v-model="form.remark"></el-input>
     </el-form-item>
     ';
   }
   public function index_body(){
     return '
     <el-table-column
       prop="id"
       label="ID"
       width="60">
     </el-table-column>

     <el-table-column
       prop="name"
       label="名称"
       width="250">
     </el-table-column>

     <el-table-column
       prop="location"
       label="位置">
     </el-table-column>

     <el-table-column
       prop="remark"
       label="备注">
     </el-table-column>
     ';
   }
   public function search_body(){
     return '
     <el-form-item label="">
       <el-input
         v-model="form.code"
         @keyup.enter.native="Search"
         placeholder="编码">
       </el-input>
     </el-form-item>
     <el-form-item label="">
       <el-input
         v-model="form.name"
         @keyup.enter.native="Search"
         placeholder="名称">
       </el-input>
     </el-form-item>
     <el-form-item label="">
       <el-input
         v-model="form.remark"
         @keyup.enter.native="Search"
         placeholder="备注">
       </el-input>
     </el-form-item>
     ';
   }


 }
